package org.example.ui.log_registration;

import javax.swing.*;
import java.awt.*;
import java.awt.event.WindowAdapter;
import java.awt.event.WindowEvent;

public class LoginRegistrationDialog extends JFrame {
    public LoginRegistrationDialog() {
        setBounds(300, 100, 800, 600);
        CardLayout cardLayout = new CardLayout();
        setLayout(new BorderLayout());
        setDefaultCloseOperation(JDialog.DISPOSE_ON_CLOSE);
        setResizable(false);
        JPanel panel = new JPanel();
        panel.setLayout(cardLayout);
        panel.setBounds(0, 0, 800, 600);
        panel.setVisible(true);
        add(panel);
        addWindowListener(new WindowAdapter() {
            @Override
            public void windowClosed(WindowEvent e) {
                System.exit(0);
            }
        });
        RegistrationPanel registrationPanel = new RegistrationPanel(cardLayout, panel);
        PasswordLoginPanel passwordLoginPanel = new PasswordLoginPanel(cardLayout, panel);
        MailBoxLoginPanel mailBoxLoginPanel = new MailBoxLoginPanel(cardLayout, panel);
        panel.add(registrationPanel, "0");
        panel.add(passwordLoginPanel, "1");
        panel.add(mailBoxLoginPanel, "2");
        cardLayout.show(panel, "1");
    }
}
